goog.provide('tipfy.ie.FormCss');
goog.provide('tipfy.ie.FormCssPatch');

goog.require('goog.dom.query');

tipfy.ie.FormCss = function(ns) {
    this.css_namespace = ns
};

tipfy.ie.FormCss.prototype.patch = function(selector, cls) {
    goog.array.map(goog.dom.query(this.css_namespace + ' ' + selector),
        function(el) {
            el.className += el.className ? ' ' + cls : cls;
        }
    );
};

tipfy.ie.FormCssPatch = function() {
    var formcss = new FormCss('.tipfy-form');
    formcss.patch('input[type=text]',             'input-text');
    formcss.patch('input[type=password]',         'input-password');
    formcss.patch('input[type=button]',           'input-button');
    formcss.patch('input[type=submit]',           'input-submit');
    formcss.patch('select[multiple=multiple]',    'select-multiple');
    formcss.patch('input[type=checkbox] + label', 'input-checkbox-label');
    formcss.patch('input[type=radio] + label',    'input-radio-label');
};
